﻿using System;
using System.Collections;
using System.IO;

using DreamCube.WebServer.WinServiceModel;
using DreamCube.Foundation.Basic.Utility;

namespace WebServer.WinServiceManager
{
    class WinService:Service
    {
        /// <summary>
        /// 服务的状态
        /// </summary>
        public MyWinService.ServiceStatus ServiceStatus
        {
            get
            {
                return MyWinService.GetServiceStatusEx(Common.KeepLiveServiceName);
            }
        }

        public override void Start()
        {
            //30秒为超时时间
            MyWinService.StartService(Common.ServiceName, new TimeSpan(0, 0, 20));
            MyWinService.StartService(Common.KeepLiveServiceName, new TimeSpan(0, 0, 20));
        }

        /// <summary>
        /// 停止服务
        /// </summary>
        public override void Stop()
        {
            //30秒为超时时间
            MyWinService.StopService(Common.KeepLiveServiceName, new TimeSpan(0, 0, 20));
        }
    }
}
